#include "widget.h"
#include "ui_widget.h"
#include<QDebug>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    connect(ui->pushButton,&QPushButton::clicked,this,&Widget::handclick);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::handclick()
{
    this->setWindowTitle("修改窗口的标题");
    qDebug()<<"handclick";
}

void Widget::handclick2()
{
     this->setWindowTitle("修改窗口的标题2");
    qDebug()<<"handclick2";
}


void Widget::on_pushButton_2_clicked()
{
    //1.先断开pushButton  原来的信号槽
    //disconnect(ui->pushButton,&QPushButton::clicked,this,&Widget::handclick);
    //2.重新绑定信号槽
    connect(ui->pushButton,&QPushButton::clicked,this,&Widget::handclick2);
}
